﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Controls_news_JS : System.Web.UI.Page
{
    string strSQL;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            // 在此处放置用户代码以初始化页面
            string picstr = "", textstr = "", linkstr = "";
            strSQL = "select top 3 * from News  where n_HomeImg=1 order by n_ID desc";
            IDataReader read1 = Class1.GetDataReader(strSQL);
            while (read1.Read())
            {
                picstr += "../" + read1["n_Img"].ToString() + "|";
                textstr += read1["n_Title"].ToString() + "|";
                linkstr += "../wjNews_View_" + read1["n_ID"].ToString() + ".html|";
            }
            read1.Close();
            picstr = picstr.Remove(picstr.Length - 1, 1);
            textstr = textstr.Remove(textstr.Length - 1, 1);
            linkstr = linkstr.Remove(linkstr.Length - 1, 1);
            Page.RegisterClientScriptBlock("tp1", "<script type='text/javascript'>var links='" + linkstr + "'</script>");
            Page.RegisterClientScriptBlock("tp2", "<script type='text/javascript'>var pics='" + picstr + "'</script>");
            Page.RegisterClientScriptBlock("tp3", "<script type='text/javascript'>var texts='" + textstr + "'</script>");
        }
    }
}
